package fr.cephb.berkeleydb.dom;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import com.sleepycat.je.DatabaseException;

public abstract class AbstractDataNode
	extends Node
	{
	private String content=null;
	AbstractDataNode(long id,Document owner,String content)
		{
		super(id,owner);
		this.content=content;
		}
	
	public String getText()
		{
		return content;
		}
	
	public void setText(String s)
		{
		this.content=s;
		synch();
		}
	
	public void append(Object s)
		{
		setText(getText()+s);
		}
	@Override
	public Node appendChild(Node n) throws DatabaseException
		{
		throw new IllegalStateException("cannot appendChild to "+getClass().getName());
		}
	
	@Override
	public abstract void write(XMLStreamWriter writer) throws XMLStreamException;
	
	}
